package com.yuntcm.group6.med_booking.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuntcm.group6.med_booking.entity.Department;
import com.yuntcm.group6.med_booking.mapper.DepartmentMapper;
import com.yuntcm.group6.med_booking.service.DepartmentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl
        extends ServiceImpl<DepartmentMapper, Department>
        implements DepartmentService {

    @Override
    public List<Department> listALllDepartment() {
        return baseMapper.selectList(null);
    }

    @Override
    public List<Department> listDepartmentsByName(String name) {
        QueryWrapper<Department> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("name", name); // 科室名称字段为 name
        return baseMapper.selectList(queryWrapper);
    }
}
